<html>
	<head>
		<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
		<link rel=StyleSheet href="styles.css" type="text/css">
		<script type="text/javascript">
			<!--
				function loadPage() {
					var json = <%= request.getAttribute("result") %>;
			
					document.getElementById("ItemID").innerHTML = decode(json["ItemID"]);
					document.getElementById("ItemName").innerHTML = decode(json["ItemName"]);
					document.getElementById("BuyPrice").innerHTML = decode(json["BuyPrice"]);
					document.getElementById("CreditCard").innerHTML = decode(json["CreditCard"]);
					document.getElementById("DateTime").innerHTML = createDateTime();
				}
				
				function decode(s) {
					return s.replace(/&amp;quot;/g, "\"")
							.replace(/&apos;/g, "\'")
							.replace(/&amp;/, "&")
							.replace(/&lt;/, "<")
							.replace(/&gt;/, ">")
							.replace(/\n/, "<br />");
				}
				
				// http://www.webdevelopersnotes.com/tips/html/getting_current_time_using_javascript.php3
				function createDateTime() {
					var d_names = new Array("Sunday", "Monday", "Tuesday",
					"Wednesday", "Thursday", "Friday", "Saturday");

					var m_names = new Array("January", "February", "March", 
					"April", "May", "June", "July", "August", "September", 
					"October", "November", "December");

					var d = new Date();
					var curr_day = d.getDay();
					var curr_date = d.getDate();
					var curr_month = d.getMonth();
					var curr_year = d.getFullYear();
					
					var date = d_names[curr_day] + ", " + m_names[curr_month] + " " + curr_date + ", " + curr_year;
					
					var a_p = "";
					var curr_hour = d.getHours();
					if (curr_hour < 12)
					{
						a_p = "AM";
					}
					else
					{
					   a_p = "PM";
					}
					if (curr_hour == 0)
					{
					   curr_hour = 12;
					}
					if (curr_hour > 12)
					{
					   curr_hour = curr_hour - 12;
					}

					var curr_min = d.getMinutes();

					curr_min = curr_min + "";

					if (curr_min.length == 1)
					{
					   curr_min = "0" + curr_min;
					}

					var time = curr_hour + ":" + curr_min + " " + a_p
					return time + " " + date;
				}
				// End code from http://www.webdevelopersnotes.com/tips/html/getting_current_time_using_javascript.php3
			-->
		</script>
		
		<title>Payment Confirmation</title>
	</head>
	
	<body id="body" onLoad="loadPage()">
		<div id="item_info">
			<table class="text">
				<tr><td width="100">ItemID:</td><td><span id="ItemID" /></td></tr>
				<tr><td width="100">ItemName:</td><td><span id="ItemName" /></td></tr>
				<tr><td width="100">BuyPrice:</td><td><span id="BuyPrice" /></td></tr>
				<tr><td width="100">Credit Card:</td><td><span id="CreditCard" /></td></tr>
				<tr><td width="100">Time:</td><td><span id="DateTime"/></td></tr>
			</table>
		</div>
	</body>
</html>
